<?php

class PresidentareaWebModule extends LinksWebModule {
    protected function initializeForPage() {
        if (!$this->isLoggedIn('eip')) {
            $this->redirectToModule('login', 'login', array('authority' => 'eip') + $this->getArrayForRequest());
        }
        $user = $this->getUser();
        $position = $user->getAttribute('position');
        if ($position <> '校長') {
            $this->unauthorizedAccess();
        }

        $this->addInlineJavascript('var loggedUser = "' . $user->getEmail() . '";');

        parent::initializeForPage();
    }
}
